package com.freecloud.javabasics.thread.cyclicBarrier;

import java.util.concurrent.CyclicBarrier;

/**
 * 循环屏障
 *
 *
 * @Author: maomao
 * @Date: 2020-02-23 18:03
 */
public class CycliBarrierDemo extends Thread {



    public static void main(String[] args) {

        //当3个线程执行完成后，执行CycliBarrierDemo线程
        CyclicBarrier cyclicBarrier = new CyclicBarrier(3,new CycliBarrierDemo());

        new Thread(new DataImportThread(cyclicBarrier,"file1")).start();
        new Thread(new DataImportThread(cyclicBarrier,"file2")).start();
        new Thread(new DataImportThread(cyclicBarrier,"file3")).start();
    }


    @Override
    public void run()
    {
        System.out.println("开始进行数据分析");
    }
}
